package view;


import java.awt.Color;
import javax.swing.JLabel;
import javax.swing.ImageIcon;
import java.awt.Image;
import java.awt.event.MouseListener;
import javax.swing.border.Border;
import javax.swing.border.EtchedBorder;
import javax.swing.border.LineBorder;

/**
 * Vista de cada posición del tablero
 * @author Samuel Chávez, Axel Mayorga
 */
public class QueenView extends JLabel 
{       
    public QueenView(int width, int height)
    {
        super();
        this.setSize(width, height);
        this.setBorder(LineBorder.createGrayLineBorder());
    }
    
    public void setImage(String img)
    {
        this.setImage(new ImageIcon(getClass().getResource(img)));
    }
    
    public void setImage(ImageIcon icon)
    {
        setIcon(new ImageIcon(icon.getImage().getScaledInstance(this.getWidth(), this.getHeight(),  java.awt.Image.SCALE_SMOOTH)));
        setIconTextGap(0);
    }
    
    public void cleanImage()
    {
        setIcon(null);
    }
    
    public void showFail()
    {
        Border etchedBorder = new EtchedBorder(EtchedBorder.RAISED, Color.red, Color.pink);
        this.setBorder(etchedBorder);
    }
    
    public void clearFail()
    {
        this.setBorder(LineBorder.createGrayLineBorder());
    }
}
